<head>
    <meta charset="UTF-8">
    <script src="axios.js"></script>
    <script src="vue.js"></script>
    <script>
        onload=function () {
            new Vue({
                el:"#d",
                data:{
                    name:"",
                    password:""
                },
                methods:{
                    login:function () {
                        axios.get('http://localhost/user/login',{
                            params:{
                                name:this.name,
                                password:this.password
                            }
                        }).then(e=> {
                            localStorage.setItem('token',e.data.token);
                            location.href="success.html"
                        });
                    }
                }
            });
        }
    </script>
</head>
<body>
<div id="d">
    <input name="name" v-model="name" placeholder="用户名" ><br>
    <input name="password" v-model="password" placeholder="密码" ><br>
    <input  type="button" @click="login" value="登录">
</div>
</body>